#define _CRT_SECURE_NO_WARNINGS 1

#include <iostream>
using namespace std;

int GetMonthday(int year, int month)
{
    int day[13] = { 0,31,28,31,30,31,30,31,31,30,31,30,31 };
    if (month == 2 && ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)))
        return 29;
    return day[month];
}

int main()
{
    int year, day;
    while (cin >> year >> day)
    {
        int month = 1;
        while (day > GetMonthday(year, month))
        {
            day -= GetMonthday(year, month);
            month++;
        }
        printf("%d-", year);
        printf("%02d-", month);
        printf("%02d\n", day);
    }
}